import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by forcht on 2018/4/19.
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       while (sc.hasNextInt()){
           int n=sc.nextInt();
           int[] number=new int[n];
           String[] s=new String[n];
           for(int i=0;i<n;i++){
               number[i]=sc.nextInt();
               s[i]=number[i]+"";
            }
           Arrays.sort(s, new Comparator<String>() {
               @Override
               public int compare(String o1, String o2) {
                   return (o2+o1).compareTo(o1+o2);
               }
           });
           for(int i=0;i<n;i++){
               System.out.print(s[i]);
           }
           System.out.println();

       }
    }
}
